package org.csu.demo.persistence;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.csu.demo.domain.CartList;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestBody;

@Repository
public interface CartListMapper extends BaseMapper<CartList> {

    @Update("UPDATE cartlist set quantity = #{quantity} where username = #{username} and itemId = #{itemId}")
    boolean updateCartQuantity(@Param("username") String username,@Param("quantity") int quantity,@Param("itemId") String itemId);

    @Delete("DELETE from cartlist where itemId = #{itemId} and username = #{username}")
    boolean deleteCartList(@Param("username") String username,@Param("itemId") String itemId);
}
